﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdGiSpatialFilter : OdRxObject
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdGiSpatialFilter(IntPtr cPtr, bool cMemoryOwn) : base(GlobalsPINVOKE.OdGiSpatialFilter_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdGiSpatialFilter obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdGiSpatialFilter()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdGiSpatialFilter(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public new static OdGiSpatialFilter cast(OdRxObject pObj)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiSpatialFilter_cast(OdRxObject.getCPtr(pObj));
			OdGiSpatialFilter result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiSpatialFilter)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiSpatialFilter)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiSpatialFilter)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdRxClass desc()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiSpatialFilter_desc(), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxClass isA()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiSpatialFilter_isA(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject queryX(OdRxClass protocolClass)
		{
			OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiSpatialFilter_queryX(this.swigCPtr, OdRxClass.getCPtr(protocolClass)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static OdGiSpatialFilter createObject()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiSpatialFilter_createObject();
			OdGiSpatialFilter result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiSpatialFilter)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiSpatialFilter)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiSpatialFilter)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdGiConveyorInput input()
		{
			OdGiConveyorInput_Internal result = new OdGiConveyorInput_Internal(GlobalsPINVOKE.OdGiSpatialFilter_input(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdGiConveyorOutput insideOutput()
		{
			OdGiConveyorOutput_Internal result = new OdGiConveyorOutput_Internal(GlobalsPINVOKE.OdGiSpatialFilter_insideOutput(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdGiConveyorOutput intersectsOutput()
		{
			OdGiConveyorOutput_Internal result = new OdGiConveyorOutput_Internal(GlobalsPINVOKE.OdGiSpatialFilter_intersectsOutput(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdGiConveyorOutput disjointOutput()
		{
			OdGiConveyorOutput_Internal result = new OdGiConveyorOutput_Internal(GlobalsPINVOKE.OdGiSpatialFilter_disjointOutput(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static OdGiConveyorGeometry kNullGeometry
		{
			get
			{
				OdGiConveyorGeometry_Internal result = new OdGiConveyorGeometry_Internal(GlobalsPINVOKE.OdGiSpatialFilter_kNullGeometry_get(), false);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
			set
			{
				GlobalsPINVOKE.OdGiSpatialFilter_kNullGeometry_set(value.GetCPtr());
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
			}
		}

		public virtual void set(OdGeExtents2d exts, bool bClipLowerZ, double dLowerZ, bool bClipUpperZ, double dUpperZ)
		{
			GlobalsPINVOKE.OdGiSpatialFilter_set__SWIG_0(this.swigCPtr, OdGeExtents2d.getCPtr(exts), bClipLowerZ, dLowerZ, bClipUpperZ, dUpperZ);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void set(OdGeExtents2d exts, bool bClipLowerZ, double dLowerZ, bool bClipUpperZ)
		{
			GlobalsPINVOKE.OdGiSpatialFilter_set__SWIG_1(this.swigCPtr, OdGeExtents2d.getCPtr(exts), bClipLowerZ, dLowerZ, bClipUpperZ);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void set(OdGeExtents2d exts, bool bClipLowerZ, double dLowerZ)
		{
			GlobalsPINVOKE.OdGiSpatialFilter_set__SWIG_2(this.swigCPtr, OdGeExtents2d.getCPtr(exts), bClipLowerZ, dLowerZ);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void set(OdGeExtents2d exts, bool bClipLowerZ)
		{
			GlobalsPINVOKE.OdGiSpatialFilter_set__SWIG_3(this.swigCPtr, OdGeExtents2d.getCPtr(exts), bClipLowerZ);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void set(OdGeExtents2d exts)
		{
			GlobalsPINVOKE.OdGiSpatialFilter_set__SWIG_4(this.swigCPtr, OdGeExtents2d.getCPtr(exts));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void get(OdGeExtents2d exts, out bool bClipLowerZ, out double dLowerZ, out bool bClipUpperZ, out double dUpperZ)
		{
			GlobalsPINVOKE.OdGiSpatialFilter_get(this.swigCPtr, OdGeExtents2d.getCPtr(exts), out bClipLowerZ, out dLowerZ, out bClipUpperZ, out dUpperZ);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual bool isSimplifyOpt(uint opt)
		{
			bool result = GlobalsPINVOKE.OdGiSpatialFilter_isSimplifyOpt(this.swigCPtr, opt);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setDrawContext(OdGiConveyorContext pDrawCtx)
		{
			GlobalsPINVOKE.OdGiSpatialFilter_setDrawContext(this.swigCPtr, pDrawCtx.GetCPtr());
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setDeviation(OdGeDoubleArray deviations)
		{
			GlobalsPINVOKE.OdGiSpatialFilter_setDeviation__SWIG_0(this.swigCPtr, OdGeDoubleArray.getCPtr(deviations));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setDeviation(OdGiDeviation pDeviation)
		{
			GlobalsPINVOKE.OdGiSpatialFilter_setDeviation__SWIG_1(this.swigCPtr, pDeviation.GetCPtr());
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		private object locker = new object();

		private HandleRef swigCPtr;
	}
}
